load("//adev/shared-docs:defaults.bzl", "copy_to_directory", "js_binary", "js_run_binary", "ts_config", "ts_project")

package(default_visibility = ["//adev:__subpackages__"])

filegroup(
    name = "context",
    srcs = glob([
        "**/*.md",
        "**/*.mdc",
    ]),
    visibility = ["//visibility:public"],
)

ts_config(
    name = "tsconfig_build",
    src = "tsconfig.json",
    deps = ["//tools:tsconfig_build"],
)

filegroup(
    name = "llms_src",
    srcs = ["llms-list.md"],
    visibility = ["//visibility:public"],
)

ts_project(
    name = "llms_lib",
    srcs = ["llms.mts"],
    tsconfig = ":tsconfig_build",
    deps = [":llms_src"],
)

js_binary(
    name = "generate_llms_full",
    data = [
        "llms.mjs",
        "llms-list.md",
        ":llms_lib",
        "//adev/src/content:guide_files",
    ],
    entry_point = ":llms.mjs",
)

js_run_binary(
    name = "run_generate_llms_full",
    outs = ["llms-full.txt"],
    tool = ":generate_llms_full",
)

copy_to_directory(
    name = "llms_full",
    srcs = [":run_generate_llms_full"],
    out = "llm-files",
)
